package com.hong.spring.controller;

import com.hong.spring.api.IUserService;
import com.hong.spring.entity.User;
import com.hong.spring.server.testapp.HelloServant;
import com.hong.spring.utils.DataResponse;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther: csh
 * @Date: 2020/8/18 16:11
 * @Description:
 */
@RestController
@RequestMapping("/user/")
@Log4j2
public class UserController {
    @Autowired
    private HelloServant helloServant;

    @RequestMapping("hello")
    public DataResponse<String> hello(int no,String name){
        try {
            return DataResponse.BuildSuccessResponse(helloServant.hello(no,name));
        } catch (Exception e){
            log.error("查询出错{}",e);
        }
        return DataResponse.BuildFailResponse("查询出错!");
    }
}
